# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=openmw
pkgver=0.46.0
pkgrel=0
pkgdesc="Open-source engine reimplementation for the role-playing game Morrowind"
# Note: only tested on the following archs, may work on others too but not
# adding them until this has been confirmed
arch="x86_64 aarch64"
url="http://www.openmw.org"
license="GPL-3.0-or-later"
makedepends="cmake boost doxygen ninja mesa-dev qt5-qtbase-dev ffmpeg-dev
	openscenegraph-dev boost-dev openal-soft-dev sdl2-dev mygui-dev bullet-dev
	libxt-dev unshield-dev gtest-dev tinyxml-dev"
# Two failing tets:
# [  FAILED  ] ContentFileTest.dialogue_merging_test
# [  FAILED  ] ContentFileTest.content_diagnostics_test
options="!check"
source="https://github.com/OpenMW/openmw/archive/openmw-$pkgver.tar.gz"

builddir=$srcdir/$pkgname-$pkgname-$pkgver

build() {
	# build OpenMW
	CXXFLAGS="$CXXFLAGS -fpermissive" cmake -B build . \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DDESIRED_QT_VERSION=5 \
		-DBUILD_WITH_CODE_COVERAGE=0 \
		-DBUILD_UNITTESTS=1 \
		-DUSE_SYSTEM_TINYXML=TRUE \
		-GNinja
	ninja -C build
}

check() {
	./build/openmw_test_suite
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
}

sha512sums="da384aead300552817c0d0ce03515a5ccc95dcab4e02d4c1dd0d6c5f1b01ee01209bbaea74e2d12021e3465e49b051823bb018de39675c5a22c6892893624486  openmw-0.46.0.tar.gz"
